import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:json_annotation/json_annotation.dart';

part 'sj_works_model.freezed.dart';
part 'sj_works_model.g.dart';

@freezed
class SjWorksModel with _$SjWorksModel {
  @JsonSerializable(explicitToJson: true)
  const factory SjWorksModel({
    final String? worksId,
    String? userId,
    final String? author,
    final String? cover,
    final List<String>? works,
    int? followed,
    int? liked,
    final String? tag,
    final String? title,
    final String? des,
    String? nickname,
    String? avatar,
    bool? isLiked,
    List<SjWorksCommentModel>? comments,
    List<String>? likedUserIdList,
    List<String>? followedUserIdList,
    bool? isPlaceholder
  }) = _SjWorksModel;

  factory SjWorksModel.fromJson(Map<String, dynamic> json) =>
      _$SjWorksModelFromJson(json);
}

@freezed
class SjWorksCommentModel with _$SjWorksCommentModel {
  @JsonSerializable(explicitToJson: true)
  const factory SjWorksCommentModel({
    final String? nickname,
        final String? avatar,
        final int? type,
        final String? content,
        final int? duration
  }) = _SjWorksCommentModel;

  factory SjWorksCommentModel.fromJson(Map<String, dynamic> json) =>
      _$SjWorksCommentModelFromJson(json);

}
